home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Prog / A / About… 2.0.cpt / About… 2.0 Intf.p < prev    next >
Encoding:
Text File  |  1991-06-16  |  4.4 KB  |  117 lines  |  [TEXT/PJMM]

  1. unit About;            { version 2.0            last update:  6/15/91 }
  2. {}
  3. {}
  4. {   About… is copyrighted, and I reserve all rights to it; both source and}
  5. {   compiled versions.  Please do not distribute this source without my}
  6. {   permission, or remove this notice.  Thanks.}
  7. {}
  8. {   Jon Wind (About…)}
  9. {   2374 Hillwood Drive}
  10. {   Maplewood, MN  55119}
  11. {}
  12. { 2.0 Changes }
  13. {    Created Modal and Modeless versions }
  14. {    Added optional support for display of styled text }
  15. {    Added support for copying styled text }
  16. {    Added ability to specify how window will be centered instead of just center or not center }
  17. {    Improved error checking in low memory conditions }
  18. {    Shift-command-c will now also copy text }
  19. {    Method of obtaining main window rect should now work for DAs, cdevs, etc }
  20. {    Window dragging now gets bounds from GrayRgn }
  21. {    Window centering routines now shift the window as neccessary to keep it entirely onscreen }
  22. {    Option clicking in the window displays the version instead of option clicking anywhere }
  23. {    OK button is now horizontally centered if MainIcon = NoIcon & Length(WinMsg) = 0; set WinMsg to an invisible character to not center it }
  24. {    OK button is disabled and default roundrect is drawn in gray if the (modeless) About window is not in front }
  25. {    Added support for close box instead of OK button for noGrowDocProc or rDocProc windows }
  26. {    Scrolling text area is extended downward if MainIcon = NoIcon & Length(WinMsg) = 0 }
  27. {    Control and window auxRecs are now used for frame and background colors }
  28. {}
  29. {$R-}
  30. interface
  31.  
  32.  
  33.     const
  34.         AboutVersion = 'About… 2.0';
  35.         AboutNoIcon = -1;
  36.         AboutNoCenter = -1;
  37.         AboutTopCenter = 0;
  38.         AboutMainCenter = 1;
  39.         AboutMsg = 0;
  40.         AboutTEXT = 1;
  41.  
  42.     type
  43.         AboutFontRec = record
  44.                 Font, Size: Integer;
  45.                 Face: Style;
  46.                 Color: Integer;
  47.             end;
  48.         AboutRec = record
  49.                 FontInfo: array[AboutMsg..AboutTEXT] of AboutFontRec;
  50.                 TEXTCopy, KeyEquivs, CloseBox, Styled: Boolean;
  51.                 CenterMode, MainIcon, ClickIcon: Integer;
  52.                 ClickMsg: Str255;
  53.             end;
  54. { Note: font color(s) must be blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor, or yellowColor }
  55. { Note: if MainIcon = AboutNoIcon then no icon will be drawn }
  56. { Note: if ClickIcon = AboutNoIcon then no icon will be drawn when original icon is clicked on }
  57. { Note: if CenterMode = AboutNoCenter the window will use the supplied coordinates and will not be centered }
  58. { Note: if CenterMode = AboutTopCenter the window will be centered on the front window or the main monitor if there is no front window }
  59. { Note: if CenterMode = AboutMainCenter the window will be centered on the main monitor }
  60. { Note: if Length(ClickMsg) = 0 then no message will be drawn when original icon is clicked on }
  61. { Note: CloseBox will be ignored for dBoxProc, plainDBox and altDBoxProc windows }
  62.  
  63.  
  64.  
  65. { Modal procedure: }
  66. { this routine does everything, returning to calling proc only after the window is dismissed... }
  67.     procedure BuildAbout (WinRect: Rect;
  68.                                     WinProc, TEXTid: Integer;
  69.                                     WinTitle, WinMsg: Str255;
  70.                                     WinMisc: AboutRec);
  71.  
  72.  
  73. { Modeless procedures: }
  74. { returns true if the specified window is an About window; otherwise returns false }
  75.     function IsAboutWindow (theWindow: WindowPtr): Boolean;
  76.  
  77. { open About window and return pointer to it - returns NIL if window is not created }
  78. { Note: you should keep track of this pointer only if you wish to keep specific track of it }
  79.     function OpenAbout (WinRect: Rect;
  80.                                     WinProc, TEXTid: Integer;
  81.                                     WinTitle, WinMsg: Str255;
  82.                                     WinMisc: AboutRec): WindowPtr;
  83.  
  84. { handle event relating to About window, ie updateEvt, activateEvt, mouseDown, keyDown, etc… }
  85. { Note: this proc should be called after every event for each About window for everything to work correctly }
  86. { Note: this proc calls the CloseAbout proc if the OK button is selected }
  87. { Note: you can filter events passed to it to simulate a modal dialog }
  88.     procedure HandleAbout (var theWindow: WindowPtr;
  89.                                     var theEvent: EventRecord);
  90.  
  91. { close the specified About window, kill data structures associated with it, and set theWindow to NIL… }
  92. { Note: this proc is called by the HandleAbout proc when an About window is dismissed by selecting its OK button }
  93. { Note: this proc should be called when the program needs to remove an About window }
  94.     procedure CloseAbout (var theWindow: WindowPtr);
  95.  
  96.  
  97.  
  98. implementation
  99.  
  100.  
  101.  
  102.     procedure BuildAbout;
  103.     external;
  104.  
  105.     function IsAboutWindow;
  106.     external;
  107.  
  108.     function OpenAbout;
  109.     external;
  110.  
  111.     procedure HandleAbout;
  112.     external;
  113.  
  114.     procedure CloseAbout;
  115.     external;
  116.  
  117. end.